#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include "stdio.h"
#include "string.h"
#include "stdlib.h"
/*
#include <stdio.h>

char *fgets(char *s, int size, FILE *stream);

fgets() reads in at most one less than size characters from stream  and
stores  them  into  the buffer pointed to by s.  Reading stops after an
EOF or a newline.  If a newline is read, it is stored into the  buffer.
A  terminating  null  byte ('\0') is stored after the last character in
the buffer.
*/
void main()
{
	int i = 0;
	FILE *fp = NULL;
	char buf[100] = {};

	//char *fname = "c:\\1.txt";
	//char *fname = "c:/a1.txt"; //统一的用45度斜杠
	char *fname = "tmp.txt";
	fp = fopen(fname, "r+"); //r+ 读写文件，文件必须存在
	if (NULL == fp)
	{
		printf("func fopen（） err: %s \n", fname);
		return ;
	}

	fgets(buf,100,fp);

    printf("%s\n", a);

	if (fp != NULL)
	{
		fclose(fp);
	}

}
